home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-06 / mmenu136.zip / QUICKNOV.MNU < prev    next >
Text File  |  1991-12-31  |  15KB  |  696 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Copyright 1990-91 by Marc Perkel * All right reserved.
  5.  
  6. This menu is a sample of a Novell ready menu. You can easilly modify it
  7. to suit your needs.
  8.  
  9. To add a choice to a menu simply use the AddChoice command
  10. then add the appropiate Onkey statement.
  11. The menu will make the size adjustments accordinaly.
  12.  
  13.   Example:
  14.       AddChoice("Print Console",10)
  15.       ...
  16.       ...
  17.       OnKey Task(10)
  18.         PConsole
  19.       ...
  20.  
  21. If you want to change the menu's center, pass the XY
  22. coordinates to menu's CenterStretchBox procedure.
  23.  
  24.    Example:
  25.       CenterStretchBox("Menu Header",10,10)
  26.  
  27. This will cause the menu to center at Col 10, Row 10
  28.  
  29. To control custom features, edit CUSTOM.INC and other INCLUDE Files.
  30.  
  31. =========================================================
  32. EndComment
  33.  
  34. ;------ Create Variables
  35.  
  36. Var
  37.   PrintQueueChoices
  38.   PortChoices
  39.   MyServer
  40.   AllUsers
  41.   NetAddress
  42.   Station
  43.   UserName
  44.   BMess
  45.   TitleBackColor
  46.   TitleInsideColor
  47.   PersonalMenu
  48.   FilePicked
  49.   KeepUsersInMenu
  50.  
  51. KeepUsersInMenu = False    ;set to True if you want to lock in users
  52.  
  53. MyServer = NovDefaultServer
  54. Station  = Str(NovConnection)
  55. UserName = NovMyLoginName
  56.  
  57. ;------ Read network address
  58.  
  59. NetAddress = NovStationAddress (NovConnection)
  60.  
  61. ;------ Personalize Your Screen Messages
  62.  
  63. StatusLineText = 'User: ' + UserName + '  *  Server: ' + MyServer
  64. StatusLineText = StatusLineText + '  *  Address: ' + NetAddress
  65. if length(StatusLineText) < 64
  66.    StatusLineText = StatusLineText + '  *  Dos: ' + DosVersionString
  67. endif
  68.  
  69. MenuTitle = 'Computer Tyme Master Menu'
  70.  
  71. Comment
  72. ==========================================================
  73.  
  74. If you want to branch to a personal menu then this routine test for the
  75. existence of a menu in the users H: directory with the same name as the
  76. users login name. It then sets an environment variable indicating if it
  77. was found. This keeps the menu fast because the test need only be made
  78. once.
  79.  
  80. ==========================================================
  81. EndComment
  82.  
  83. ;------ Set Personal Menu in Environment Variable if menu exists
  84.  
  85. PersonalMenu = ReadEnv('PMENU')
  86. if PersonalMenu = ''
  87.    PersonalMenu = 'H:' + NovMyLoginName + '.MNU'    ;Z: is my home directory
  88.    if not ExistFile (PersonalMenu)
  89.       PersonalMenu = 'NONE'
  90.    endif
  91.    SetEnv('PMENU=' + PersonalMenu)
  92. endif
  93.  
  94. ;------ Load menu look and feel include files
  95.  
  96. Include 'CUSTOM.INC'
  97.  
  98. Comment
  99. ==========================================================
  100.  
  101. MarxMenu is capable of software metering. This means that it can limit
  102. the number of users of an application to a fixed amount.
  103.  
  104.   OnKey Task (2)
  105.      |if Limit('LOTUS',6) then Return  ;limit Lotus to 6 Users
  106.      CD \PUBLIC\LOTUS
  107.      123
  108.  
  109. Read the METER.INC file for more details.
  110.  
  111. ==========================================================
  112. EndComment
  113.  
  114. Include 'METER.INC'  ;Software Metering
  115.  
  116. Comment
  117. ==========================================================
  118.  
  119. I have defined a procedure called CenterStretchBox which takes as
  120. parameters a menu title, array of choices, and the XY coordinants
  121. of the center of the window. CenterStretchBox then displays all the
  122. choices and numbers them. This method allows me to update the menu
  123. more quickly.
  124.  
  125. ==========================================================
  126. EndComment
  127.  
  128. AppendArray(PortChoices,'Lpt1')
  129. AppendArray(PortChoices,'Lpt2')
  130. AppendArray(PortChoices,'Lpt3')
  131.  
  132. Comment
  133. =================================
  134.  
  135. In order to add menu choices conditionally you would append the
  136. choices to the end of the array after all the default choices
  137. are set. For Example:
  138.  
  139.    if NovInGroup("ACCOUNTING")
  140.       AddChoice("Payroll Menu",10)
  141.    endif
  142.  
  143. Here is where menus are created.
  144.  
  145. =================================
  146. EndComment
  147.  
  148. ;----- Main Menu
  149.  
  150. AddChoice('Accounting',1)
  151. AddChoice('Word Processing',2)
  152. AddChoice('SpreadSheet',3)
  153. AddChoice('DataBase',4)
  154. AddChoice('Graphics',5)
  155. AddChoice('Communication',6)
  156. AddChoice('Publishing',7)
  157. AddChoice('Utilities',20)
  158. if PersonalMenu <> 'NONE' then AddChoice('Personal Menu',25)
  159.  
  160. CornerStretchBox ('Main Menu',11,6)
  161.  
  162. OnKey Task(1)
  163.    |Error('Put Code for Accounting here.')
  164.  
  165. OnKey Task(2)
  166.    |Error('Put Code for Word Processing here.')
  167.  
  168. OnKey Task(3)
  169.    |Error('Put Code for SpreadSheet here.')
  170.  
  171. OnKey Task(4)
  172.    |Error('Put Code for DataBase here.')
  173.  
  174. OnKey Task(5)
  175.    |Error('Put Code for Graphics here.')
  176.  
  177. OnKey Task(6)
  178.    |Error('Put Code for Communication here.')
  179.  
  180. OnKey Task(7)
  181.    |Error('Put Code for Publishing here.')
  182.  
  183. OnKey Task(20)
  184.    ^Util
  185.  
  186. OnKey Task(25)
  187.    |Bat 'Marx ' + PersonalMenu
  188.  
  189. OnKey ESC
  190.    |if NovConsoleOperator or not KeepUsersInMenu
  191.    |   LeaveMenu
  192.    |endif
  193.  
  194. ;----- Util Menu
  195.  
  196. :Util
  197.  
  198. AddChoice('Printer Select',1)
  199. AddChoice('Format Disk Menu',2)
  200. AddChoice('Dos Functions',3)
  201. AddChoice('Novell Information',4)
  202. AddChoice('Novell User Options',5)
  203. if NovConsoleOperator
  204.    AddChoice('Novell Utilities',6)
  205.    AddChoice('Maintainence',7)
  206.    AddChoice('Menu Utilities',8)
  207.    AddChoice('Command Line',9)
  208. endif
  209.  
  210. CornerStretchBox ('Utility Menu',43,6)
  211.  
  212. OnKey Task(1)
  213.   |SelectPrintQueue
  214.   |Dispose Choices
  215.   |LastKey = ' '
  216.  
  217. OnKey Task(2)
  218.   |SelectFormat
  219.   |LastKey = ' '
  220.  
  221. OnKey Task(3)
  222.   ^Dos
  223.  
  224. OnKey Task(4)
  225.   ^NovInfo
  226.  
  227. OnKey Task(5)
  228.   ^NovUser
  229.  
  230. OnKey Task(6)
  231.   ^NovUtils
  232.  
  233. OnKey Task(7)
  234.   ^Maint
  235.  
  236. OnKey Task(8)
  237.   ^MenuUtil
  238.  
  239. OnKey Task(9)
  240.   |if ExistOnPath('DOLIST.EXE') > ''
  241.      DropTo DoList
  242.   |else
  243.   |  Bat 'DropTo ' + ReadEnv('COMSPEC')
  244.   |endif
  245.  
  246. ;----- Dos Menu
  247.  
  248. :Dos
  249.  
  250. AddChoice('Directory Master',1)
  251. AddChoice('Pick Directory',2)
  252. AddChoice('Show Directory',3)
  253. AddChoice('Free Space',4)
  254. AddChoice('Memory Map',5)
  255. AddChoice('Device Drivers',6)
  256.  
  257. CenterStretchBox ('DOS Menu',38,15)
  258.  
  259. OnKey Task(1)
  260.   |if NovConsoleOperator
  261.      DropTo DM3
  262.   |else
  263.      DropTo DMLITE
  264.   |endif
  265.  
  266. OnKey Task(2)
  267.    PD
  268.  
  269. OnKey Task(3)
  270.    D/W
  271.  
  272. OnKey Task(4)
  273.    Free
  274.    Pause
  275.  
  276. OnKey Task(5)
  277.    RamMap
  278.    Pause
  279.  
  280. OnKey Task(6)
  281.    Device
  282.    Pause
  283.  
  284.  
  285. ;----- Novell Utilities Menu
  286.  
  287. :NovUtils
  288.  
  289. AddChoice('Session Management',1)
  290. AddChoice('File Management',2)
  291. AddChoice('Volume Information',3)
  292. AddChoice('System Configuration',4)
  293. AddChoice('File Server Monitoring',5)
  294. AddChoice('Print Queue Management',6)
  295. AddChoice('Print Job Configurations',7)
  296. AddChoice('Printer Definitions',8)
  297. AddChoice('Folio Help System',9)
  298.  
  299. CenterStretchBox ('Novell Utilities',38,15)
  300.  
  301. OnKey Task(1)
  302.    Session
  303.  
  304. OnKey Task(2)
  305.    Filer
  306.  
  307. OnKey Task(3)
  308.    VolInfo
  309.  
  310. OnKey Task(4)
  311.    Syscon
  312.  
  313. OnKey Task(5)
  314.    FConsole
  315.  
  316. OnKey Task(6)
  317.    PConsole
  318.  
  319. OnKey Task(7)
  320.    PrintCon
  321.  
  322. OnKey Task(8)
  323.    PrintDef
  324.  
  325. OnKey Task(9)
  326.    P:Help
  327.  
  328. ;----- Novell Information Menu
  329.  
  330. :NovInfo
  331.  
  332. AddChoice('UserList',1)
  333. AddChoice('Drive Map',2)
  334. AddChoice('Current Dir',3)
  335. AddChoice('Directory Rights',4)
  336. AddChoice('List Servers',5)
  337. AddChoice('Who Am I?',6)
  338. AddChoice('Trustees',7)
  339. AddChoice('System Time',8)
  340. AddChoice('ChkVol',9)
  341. AddChoice('Printer Status',10)
  342.  
  343. CenterStretchBox ('Novell Information',38,15)
  344.  
  345. OnKey Task(1)
  346.    UserList/A
  347.    Echo.
  348.    Pause
  349.  
  350. OnKey Task(2)
  351.    Map
  352.    Echo.
  353.    Pause
  354.  
  355. OnKey Task(3)
  356.    NDir
  357.    Pause
  358.  
  359. OnKey Task(4)
  360.    Rights
  361.    Echo.
  362.    Pause
  363.  
  364. OnKey Task(5)
  365.    SList
  366.    Echo.
  367.    Pause
  368.  
  369. OnKey Task(6)
  370.    WhoAmI/A
  371.    Echo.
  372.    Pause
  373.  
  374. OnKey Task(7)
  375.    TList
  376.    Echo.
  377.    Pause
  378.  
  379. OnKey Task(8)
  380.    SysTime
  381.    Echo.
  382.    Pause
  383.  
  384. OnKey Task(9)
  385.    ChkVol
  386.    Echo.
  387.    Pause
  388.  
  389. OnKey Task(10)
  390.    Capture Show
  391.    Echo.
  392.    Pause
  393.  
  394. ;----- Novell User Menu
  395.  
  396. :NovUser
  397.  
  398. AddChoice('Change Password',1)
  399. AddChoice('Block Messages',2)
  400. AddChoice('Receive Messages',3)
  401. AddChoice('End Printer Capture',4)
  402. AddChoice('Send a Message',5)
  403.  
  404. CenterStretchBox ('Novell User Menu',38,15)
  405.  
  406. OnKey Task(1)
  407.    SetPass
  408.  
  409. OnKey Task(2)
  410.    CastOff
  411.  
  412. OnKey Task(3)
  413.    CastOn
  414.  
  415. OnKey Task(4)
  416.    EndCap
  417.  
  418. OnKey Task(5)
  419.    |SendMessage
  420.  
  421. ;----- Maintenence Menu
  422.  
  423. :Maint
  424.  
  425. AddChoice('Tape Backup',1)
  426. AddChoice('Delete *.BAK Files',2)
  427. AddChoice('Delete *.MRX Files',3)
  428.  
  429. CenterStretchBox ('Maintenence Menu',38,15)
  430.  
  431. OnKey Task(1)
  432.    |Error('Put Code for your Tape Backup Software here.')
  433.  
  434. OnKey Task(2)
  435.    Whereis *.BAK /D
  436.  
  437. OnKey Task(3)
  438.    Whereis *.MRX /D
  439.  
  440. ;----- Menu Utilities
  441.  
  442. :MenuUtil
  443.  
  444. AddChoice('Edit this Menu',1)
  445. AddChoice('View Include Files',2)
  446. AddChoice('Edit Include Files',3)
  447. AddChoice('View a Menu File',4)
  448. AddChoice('Edit a Menu File',5)
  449. AddChoice('Run a Menu',6)
  450. AddChoice('Load MarxHelp',7)
  451. AddChoice('UnLoad MarxHelp',8)
  452.  
  453. CenterStretchBox ('Menu Utilities',38,15)
  454.  
  455. OnKey Task(1)
  456.    ME %MenuFileName
  457.  
  458. OnKey Task(2)
  459.    |FilePicked = PickAFile('*.INC','Include Files')
  460.    |ViewFile(FilePicked)
  461.  
  462. OnKey Task(3)
  463.    |FilePicked = GetIncludeFile
  464.    |if FilePicked > ''
  465.    |   Bat 'ME ' + FilePicked
  466.    |endif
  467.  
  468. OnKey Task(4)
  469.    |FilePicked = PickAFile ('*.MNU','Menus')
  470.    |ViewFile(FilePicked)
  471.  
  472. OnKey Task(5)
  473.    |FilePicked = PickAFile ('*.MNU','Menus')
  474.    |if FilePicked > ''
  475.    |   Bat 'ME ' + FilePicked
  476.    |endif
  477.  
  478. OnKey Task(6)
  479.    |FilePicked = PickAFile ('*.MNU','Menus')
  480.    |if FilePicked > ''
  481.    |   Bat 'MARX ' + FilePicked
  482.    |endif
  483.  
  484. OnKey Task(7)
  485.    |MxCmd = 'MarxHelp'
  486.  
  487. OnKey Task(8)
  488.    |MxCmd = 'MarxHelp /U'
  489.  
  490. ;----- This routines selects a print queue
  491.  
  492. Procedure SelectPrintQueue
  493. var Queue PrnPort QCmd LocalName
  494.  
  495.    LocalName = '<Local Printer>'
  496.    if NumberOfElements(PrintQueueChoices) = 0
  497.       NovMyPrintQueues(PrintQueueChoices)
  498.       SortArray(PrintQueueChoices)
  499.       AppendArray(PrintQueueChoices,LocalName)
  500.    endif
  501.  
  502.    Choices = PrintQueueChoices
  503.    DrawTheBox(28,11,23,Min(12,NumberOfElements(Choices) + HeightDifference),'Print Queues')
  504.    Queue = PickOne(Choices)
  505.    if LastKey = Esc then Return
  506.    Choices = PortChoices
  507.    CenterStretchBox ('Port',38,20)
  508.    PrnPort = Ord(ReadKey) - 64
  509.    if LastKey = Esc then Return
  510.    EraseTopWindow
  511.  
  512.    if Queue = LocalName
  513.       NovEndCapture (PrnPort)
  514.    else
  515.       NovCaptureQueue (PrnPort) = Queue
  516.       NovCaptureTimeOut (PrnPort) = 5
  517.    endif
  518.  
  519. EndProc
  520.  
  521. ;----- This routines selects floppy disk format
  522.  
  523. Procedure SelectFormat
  524. var Ch Message Option
  525.  
  526.    DrawTheBox(20,12,42,4 + HeightDifference,'Format Floppy Disk Menu')
  527.  
  528.    Writeln ' 1 - Format 360    5 - Format /S 360'
  529.    Writeln ' 2 - Format 1.2M   6 - Format /S 1.2M'
  530.    Writeln ' 3 - Format 720    7 - Format /S 720'
  531.    Write   ' 4 - Format 1.4M   8 - Format /S 1.4M'
  532.  
  533.    Ch = ReadKey
  534.  
  535.    if Ch = '1'
  536.       Message = '360k Format with no System Files.'
  537.       Option = '/4'
  538.  
  539.    elseif Ch = '2'
  540.       Message = '1.2m Format with no System Files.'
  541.       Option = ''
  542.  
  543.    elseif Ch = '3'
  544.       Message = '720k Format with no System Files.'
  545.       Option = '/N:9/T:80'
  546.  
  547.    elseif Ch = '4'
  548.       Message = '1.4m Format with no System Files.'
  549.       Option = '/N:18/T:80'
  550.  
  551.    elseif Ch = '5'
  552.       Message = '360k Format with System Files.'
  553.       Option = '/4/S'
  554.  
  555.    elseif Ch = '6'
  556.       Message = '1.2m Format with System Files.'
  557.       Option = '/S'
  558.  
  559.    elseif Ch = '7'
  560.       Message = '720k Format with System Files.'
  561.       Option = '/N:9/T:80/S'
  562.  
  563.    elseif Ch = '8'
  564.       Message = '1.4m Format with System Files.'
  565.       Option = '/N:18/T:80/S'
  566.  
  567.    else
  568.       Return
  569.  
  570.    endif
  571.  
  572.    if DosVersionString >= '5.00'
  573.       Option = Option + '/U'     ;unconditional
  574.       Option = Option + '/V:DOS' ;automatically adds volume label
  575.    endif
  576.  
  577.    DrawTheBox(46,18,11,2 + HeightDifference,'Drive')
  578.    Writeln '  A:'
  579.    Write   '  B:'
  580.    Ch = ReadKey
  581.    if Ch = Esc then Return
  582.    ExecFormat(Ch,Option,Message)
  583. EndProc
  584.  
  585. ;----- Execute FORMAT in a DOS Window
  586.  
  587. Procedure ExecFormat (Drv,Option,Message)
  588. var FormatProg
  589.  
  590.    FormatProg = ExistOnPath('FORMAT.EXE')
  591.    if FormatProg = '' then FormatProg = ExistOnPath('FORMAT.COM')
  592.    if FormatProg = ''
  593.       Error('FORMAT program not Found!')
  594.       Return
  595.    endif
  596.  
  597.    BoxHeader = ' Formatting Drive ' + Drv + ': ' + Message + ' '
  598.    Shadow Off
  599.    DrawBox 1 4 80 21
  600.    Window  4 5 74 19
  601.    Writeln
  602.    ExecProg (FormatProg + ' ' + Drv + ': ' + Option)
  603.    EraseTopWindow
  604. EndProc
  605.  
  606. ;----- Sends a novell message
  607.  
  608. Procedure SendMessage
  609. var Choice Message
  610.    Choice = PickUser('Send message To')
  611.    if Choice = '' then Return
  612.    Message = ReadTextLine('Message:','',0,21)
  613.    if LastKey = Esc then Return
  614.    ClearScreen
  615.    TextColor MenuHeaderFG MenuBG
  616.    Write ' Sending ... '
  617.    ClearScreenFirst Off
  618.    ExecProg ('Send "' + Message + '" to ' + Choice + '>nul')
  619. EndProc
  620.  
  621. ;----- Select Include File
  622.  
  623. Procedure GetIncludeFile
  624. var IncPath
  625.    IncPath = PathPart(ExistOnPath('CUSTOM.INC'))
  626.    IncPath = PickAFile(CleanFileName(IncPath + '\*.INC'),'Include Files')
  627.    if IncPath = '' then Return ''
  628.    DelFile(ForceExtension(%MenuFileName,'MRX'))
  629.    Return IncPath
  630. EndProc
  631.  
  632. ;----- Reads a list of all users on the system
  633.  
  634. Procedure ReadUsers
  635.    if NumberOfElements(AllUsers) > 0 then Return
  636.    NovUsersLoggedIn(AllUsers)
  637.    SortArray(AllUsers)
  638. EndProc
  639.  
  640.  
  641. Procedure PickUser (Message)
  642. var MaxSize
  643.    ReadUsers
  644.    MaxSize = Min(15,NumberOfElements(AllUsers))
  645.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  646.    Return PickOne(AllUsers)
  647. EndProc
  648.  
  649. ;----- Execute a program in a window
  650.  
  651. Procedure ExecProg (Prog)
  652.    TextColor MenuHeaderFG MenuBG
  653.    Cursor Off
  654.    DosWindow
  655.    Execute Prog
  656. EndProc
  657.  
  658. ;----- View a File
  659.  
  660. Procedure ViewFile (Name)
  661.    if Name = '' then Return
  662.    BoxHeader = ' Viewing ' + Name + ' '
  663.    Shadow Off
  664.    DrawBox 1 4 80 21
  665.    TextColor MenuHeaderFG MenuBG
  666.    ViewTextFile Name
  667. EndProc
  668.  
  669. Procedure PickAFile (Mask,Message)
  670. var Files Choice MaxSize
  671.    ReadDirectory(Mask,Files)
  672.    MaxSize = Min(15,NumberOfElements(Files))
  673.    if MaxSize = 0
  674.       Error('No Choices!')
  675.       Return ''
  676.    endif
  677.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  678.    Choice = PickOne(Files)
  679.    Return Choice
  680. EndProc
  681.  
  682. ;----- Display Error and Wait for a Key
  683.  
  684. Procedure Error (Err)
  685. var Ch
  686.    BoxHeader = ' Error * Press any Key '
  687.    DrawBox 11 19 Max(27,length(Err) + 4) 3
  688.    Cursor Off
  689.    UseArrows Off
  690.    TextColor MenuHeaderFG MenuBG
  691.    WriteCenter Err
  692.    Write Char(7)
  693.    Ch = ReadKey
  694.    EraseTopWindow
  695. EndProc
  696.